Use all function arguments. Be able to access all code {code access}.
Add comments {code comments} for logical units. Add comments for modifications. Add inline comment after final brace to identify original brace.
Use IF-THEN-ELSE {conditional statement, software}, rather than multiple IFs. Use compound IFs, rather than nested IFs. Use braces for nested IF blocks. Always use ELSE after ELSE IF. Enter NULL statement ";" in IF block with no action. Use Switch statements, rather than IF-THEN-ELSE, if possible. Use default Switch at end, containing at least break statement.
Use symbolic constants {constant, software}, with no hard-coded numbers.
Do not use mixed data types {data type} in expressions. Do not use machine-dependent data representations.
Use dynamic memory {dynamic memory, computer}, rather than allocating fixed storage. Verify that memory gave information. Free all memory structures no longer used. Allocate memory to structures to keep before structures to free, to avoid memory leaks.
Use parameters for error messages {error message} and error numbers, not many hard-coded messages.
Put file name, author, creation date, description, purpose, and modification history in file header {file header, information}.
Put function name, author, creation date, short description, usage, possible return codes, and modification history in function header {function header}.
Return success or failure status {function return} {return, function} to caller. Check status in caller. Store function-return codes in caller for future reference. Do not test function logical value directly. Declare return "void" for functions that do not return value. Declare argument list "void" for functions that do not use parameters.
Do not use GOTO statements {GOTO command}.
Put definitions, global-variable declarations, and function prototypes in header files {header file}. Use "include" statements. For static functions used by one module, put prototype at module top.
Check input values {input, software} for range and reasonableness.
Do not reinitialize index variables in loops {looping, software}. Do not use non-loop-dependent statements in loop bodies.
Put modules in separate files {module files}. Put source code for C++ classes in .CXX files. Put class definitions in .HXX files. Use only logically related functions. Use one entry and exit point for each function. Exit program only through "main" command.
Make object names {object names, software} descriptive and globally unique. Use suffix for object types, like libraries. For functions, use lowercase or mixed case. For variables, use lowercase or mixed case. For constants, use uppercase.
Minimize operating-system services {operating system services}. Put operating-system services in "system" library, not in high-level code.
Separate variables and operators {readability, software}. Write one statement per line, using consistent indentation for logical structure. Place lead brace on same line as statement, or place on next line in same column as statement beginning. Put end brace in same column as statement beginning. Indicate conditional statement using inline comment after end brace.
Use only standard programming language {standard usage, software}.
Use one line for each variable declaration {variable declaration}. Minimize number of global variables and external variables by passing arguments by value or reference. Declare arrays and do not use pointers except for dynamically allocated memory. Use structures for related data elements, to treat them as single objects.
Do not exit from WHILE-statement body {WHILE command}.
Only methods can access objects {encapsulation, programming}.
You can make a child class with all the members and methods of a parent class, and then add extra members and methods {inheritance, programming}.
If classes share common methods, the same methods can apply to all the classes {polymorphism, programming}.
You can use a child-class instance if you can use a parent-class instance {Liskov Substitution Principle}.
3-Computer Science-Software-Programming
Outline of Knowledge Database Home Page
Description of Outline of Knowledge Database
Date Modified: 2022.0225